home *** CD-ROM | disk | FTP | other *** search
/ Apple Reference & Presen…rary 8 (Internal Edition) / Apple R&P Lib Internal v8.0.iso / 5-Fonts & Software / Applications / Canvas™ 3.0 / Canvas Tools / Separations / Separations.rsrc / hd11_1011_Separation defs < prev    next >
Text File  |  1990-06-24  |  10KB  |  364 lines

  1. %---Sep stuff
  2. /CurrentProc{currentscreen exch pop exch pop}bdf
  3. /CurrentFreq{currentscreen pop pop}bdf
  4. /dopageclip{initmatrix pgl dup pgt moveto pgb lineto pgr pgb lineto pgr pgt lineto pgl pgt lineto closepath clippath newpath}bdf
  5. /doSepStuff {
  6.     /inch {72 mul} bdf
  7.     /UCRB 0.5 def    % - Black undercolor removal starts at 50 percent
  8.     /UCRM 0.31 def    % - percent of magenta UCR
  9.     /UCRY 0.48 def    % - percent of yellow UCR
  10.     /setAngles{/blackAngle edf/yellowAngle edf/magentaAngle edf/cyanAngle edf}bdf
  11.     /DoColor{color dup 2 copy dup 0 eq{black}if 1 eq{yellow}if 2 eq{magenta}if 3 eq{cyan}if 4 eq{comp}if}bdf
  12.     /getScale{1 1 rotmtx defaultmatrix dtransform 1 1 dtransform 4 2 roll exch 3 index div exch 2 index div 4 2 roll pop pop}bdf
  13.     /regMarks{gsave translate getScale scale 0.3 setlinewidth newpath
  14.     10 0 moveto 0 0 10 0 360 arc 1 setgray fill
  15.     0 setgray 8 0 moveto 0 0 8 0 360 arc
  16.     -10 0 moveto 10 0 lineto 0 -10 moveto 0 10 lineto stroke
  17.     4 0 moveto 0 0 4 0 360 arc fill
  18.     -4 0 moveto 4 0 lineto 0 -4 moveto 0 4 lineto 1 setgray stroke grestore}bdf
  19.     /doregmarks{/addamt getScale pop 12 mul abs def systemdict begin 
  20.     pgl addamt add  pgb addamt sub regMarks
  21.     pgl addamt add  pgt addamt add regMarks
  22.     pgr addamt sub  pgb addamt sub regMarks
  23.     pgr addamt sub  pgt addamt add regMarks
  24.     end}def
  25.     /objColor 4 array def
  26.     /SepSetUp{/JName edf/Names edf/Marks edf/DocumetName edf}bdf
  27.     /doWide{matrix currentmatrix aload 7 1 roll 6 2 roll exch 4 2 roll exch 4 2 roll 6 -2 roll 7 -1 roll astore setmatrix }bdf
  28.     /showJName{ pgl 150 add pgt 10 add moveto DocumetName show}bdf
  29.     /dooptions{Marks{doregmarks}if JName{showJName}if}bdf 
  30.     /crpln{gsave .3 DocScale div setlinewidth newpath 4 2 roll translate 0 5 2 index mul moveto 0 15 DocScale div 3 -1 roll mul rlineto 5 1 index mul 0 moveto 15 DocScale div mul 0 rlineto systemdict begin 0 setgray end stroke grestore}bdf
  31.     /Crops{gsave 2 copy 1 1 crpln 3 index exch -1 1 crpln 1 index 1 -1 crpln -1 -1 crpln grestore}bdf
  32.     /cyan {
  33.         /color 3 def
  34.         /addamt getScale pop abs def
  35.         Freq cyanAngle /CSepProc load setscreen
  36.         0 setgray
  37.         gsave
  38.             dopageclip
  39.             systemdict begin 0 setgray end
  40.             pgl 100 addamt mul add pgb 9 addamt mul sub moveto
  41.             /Times-Roman findfont
  42.             9 addamt mul scalefont setfont
  43.             Names{(CYAN) show}if
  44.             dooptions
  45.         grestore
  46.         } def
  47.     /magenta {
  48.         /color 2 def
  49.         /addamt getScale pop abs def
  50.         Freq magentaAngle /MSepProc load setscreen
  51.         0 setgray
  52.         gsave
  53.             dopageclip
  54.             systemdict begin 0 setgray end
  55.             pgl 200 addamt mul add pgb 9 addamt mul sub moveto
  56.             /Times-Roman findfont
  57.             9 addamt mul scalefont setfont
  58.             Names{(MAGENTA) show}if
  59.             dooptions
  60.         grestore
  61.         } def
  62.     /yellow {
  63.         /color 1 def
  64.         /addamt getScale pop abs def
  65.         Freq yellowAngle /YSepProc load setscreen
  66.         0 setgray
  67.         gsave
  68.             dopageclip
  69.             systemdict begin 0 setgray end
  70.             pgl 300 addamt mul add pgb 9 addamt mul sub moveto
  71.             /Times-Roman findfont
  72.             9 addamt mul scalefont setfont
  73.             Names{(YELLOW) show}if
  74.             dooptions
  75.         grestore
  76.         } def
  77.     /black
  78.         {
  79.         /color 0 def
  80.         /addamt getScale pop abs def
  81.         Freq blackAngle /BSepProc load setscreen
  82.         0 setgray
  83.         gsave
  84.             dopageclip
  85.             systemdict begin 0 setgray end
  86.             pgl 400 addamt mul add pgb 9 addamt mul sub moveto
  87.             /Times-Roman findfont
  88.             9 addamt mul scalefont setfont
  89.             Names{(BLACK) show}if
  90.             dooptions
  91.         grestore
  92.         } def
  93.     /comp {
  94.         gsave
  95.             /addamt getScale pop abs def
  96.             dopageclip
  97.             systemdict begin 0 setgray end
  98.             pgl 100 addamt mul add pgb 9 addamt mul sub moveto
  99.             /Times-Roman findfont
  100.             9 addamt mul scalefont setfont
  101.             Names{(Composite) show}if
  102.             dooptions
  103.         grestore
  104.         } def
  105.     color 4 ne{
  106.     COver MOver YOver BOver or or or
  107.     {
  108.         /oktodo
  109.         {
  110.             currentgray 1 eq
  111.             {
  112.                 COver{objColor 0 get}{F}ifelse 
  113.                 MOver{objColor 1 get}{F}ifelse 
  114.                 YOver{objColor 2 get}{F}ifelse
  115.                 BOver{objColor 3 get}{F}ifelse
  116.                 or or or not
  117.             }
  118.             {T}ifelse
  119.         }bdf
  120.         /stroke{oktodo{systemdict begin stroke end}{newpath}ifelse}bdf
  121.         /fill{oktodo{systemdict begin fill end}{newpath}ifelse}bdf
  122.         /image{systemdict /image get exec}bdf
  123.     }
  124.     {
  125.         /image{
  126.                 color 0 eq color 4 eq or    %black/composite plate
  127.                 {i}        %simple enough
  128.                 { % 1 color on something other than black
  129.                     3 1 roll pop pop
  130.                     3 1 roll    % proc width height
  131.                     exch pop
  132.                     exch
  133.                     repeat    %remove data
  134.                     gsave
  135.                     newpath
  136.                     0 0 moveto 
  137.                     1 0 rlineto
  138.                     0 1 rlineto
  139.                     -1 0 rlineto
  140.                     closepath erasefill        %erase the puppy
  141.                     grestore
  142.                 }ifelse
  143.             }bdf
  144.         /stroke{systemdict begin stroke end}bdf
  145.         /fill{systemdict begin fill end}bdf
  146.  
  147.     }ifelse
  148.  
  149.     /setgray {
  150.         dup F F F 4 -1 roll 1 ne objColor astore pop
  151.         color 0 eq {
  152.             systemdict begin setgray end
  153.             }
  154.             {
  155.             pop systemdict begin 1 setgray end
  156.         } ifelse
  157.         } def
  158.     /setmkcolor{do_ucrblack 4 1 roll do_correct 4 -1 roll 4 copy 1 1 4{pop 1 ne 4 1 roll}for objColor astore pop}bdf
  159.     /setcmykcolor {
  160.         4 copy 1 1 4{pop 1 ne 4 1 roll}for objColor astore pop
  161.         color index 1 exch sub systemdict begin setgray end pop pop pop pop
  162.         } def
  163.     /setrgbcolor {
  164.         color 0 eq {
  165.             setmkcolor
  166.             systemdict begin setgray end pop pop pop}
  167.             {
  168.             setmkcolor pop
  169.             color 1 sub index
  170.             systemdict begin setgray end
  171.             pop pop pop
  172.             } ifelse
  173.         } def
  174.     /do_correct {
  175.         cvtrgbcym
  176.         1 index UCRY mul sub dup 0 lt{ pop 0}if 3 1 roll
  177.         1 index UCRM mul sub dup 0 lt{ pop 0}if 3 1 roll
  178.         3 1 roll
  179.         cvtrgbcym
  180.         } def
  181.     /do_ucrblack {
  182.         3 copy 1 index eq 3 1 roll eq and{pop pop 1 1 1 4 -1 roll}{
  183.         cvtrgbcym
  184.         cmin 3 index cmin
  185.         /mincolor edf
  186.         pop pop
  187.         /ucramt mincolor UCRB sub
  188.         dup 0 lt{ pop 0} if def
  189.         ucramt sub 3 1 roll
  190.         ucramt sub 3 1 roll
  191.         ucramt sub 3 1 roll
  192.         cvtrgbcym
  193.         ucramt 1.25 mul
  194.         1 exch sub}ifelse
  195.         } def
  196.     /cvtrgbcym {
  197.         3 {1 exch sub 3 1 roll} repeat
  198.         } def
  199.     /cmin {
  200.         2 copy lt {1}{0} ifelse
  201.         index
  202.         } def
  203.     }if
  204.     /colorimage
  205.     {
  206.         /ncolors edf
  207.         /multiproc edf
  208.         color 4 ne
  209.         { % 4 plate separations
  210.             ncolors 1 eq
  211.             { %single color, single proc
  212.                 color 0 eq color 4 eq or %black/composite plate
  213.                 {i}        %simple enough
  214.                 { % 1 color on something other than black
  215.                     3 1 roll pop pop % proc width height
  216.                     3 1 roll
  217.                     /h edf
  218.                     /w edf
  219.                     gsave
  220.                     newpath
  221.                     0 0 moveto 
  222.                     1 0 rlineto
  223.                     0 1 rlineto
  224.                     -1 0 rlineto
  225.                     closepath erasefill        %erase the puppy
  226.                     grestore
  227.                     h exch repeat    %remove data
  228.                 }ifelse
  229.             }
  230.             { %multiple colors
  231.                 multiproc % colors are separated by their own procedures
  232.                 {
  233.                     ncolors 4 eq %separate cmyk images. the easist
  234.                     {
  235.                         /proc3 edf
  236.                         /proc2 edf
  237.                         /proc1 edf
  238.                         /proc0 edf
  239.                         {
  240.                             %pop all but current color string for image
  241.                             proc0 color 3 ne{pop}if    %cyan
  242.                             proc1 color 2 ne{pop}if %magenta
  243.                             proc2 color 1 ne{pop}if    %yellow
  244.                             proc3 color 0 ne{pop}if %black
  245.                         }
  246.                         i
  247.                     }% end separate cmyk colors
  248.                     {% begin separate rgb colors
  249.                         /proc2 edf
  250.                         /proc1 edf
  251.                         /proc0 edf
  252.                         {
  253.                             proc0    /st0 edf %get red string
  254.                             proc1    /st1 edf %get green string
  255.                             proc2    /st2 edf %get blue string
  256.                             0 %start
  257.                             1 %increment
  258.                             st0 length 1 sub %end
  259.                             {
  260.                                 dup    % dup index
  261.                                 st0 exch get 255.0 div            %get red value
  262.                                 exch dup st1 exch get 255.0 div    %get green value
  263.                                 exch dup st2 exch get 255.0 div %get blue value
  264.                                 exch                %leave index on top
  265.                                 %Stack == Red Green Blue Index
  266.                                 4 1 roll
  267.                                 %Stack == Index Red Green Blue
  268.                                 %now convert the RGB value to a good CMYK value to separate
  269.                                 do_ucrblack
  270.                                 /b edf
  271.                                 do_correct
  272.                                 /y edf
  273.                                 /m edf
  274.                                 /c edf
  275.                                 color 3 eq{c}if    %cyan
  276.                                 color 2 eq{m}if %magenta
  277.                                 color 1 eq{y}if    %yellow
  278.                                 color 0 eq{b}if %black
  279.                                 255.0 mul cvi
  280.                                 cvi st0 3 1 roll put % we store it in the red string
  281.                             }for
  282.                             st0    %leave it on stack for image
  283.                         }
  284.                         i
  285.                     } % end of rgb colors
  286.                     ifelse
  287.                 } %end of if multiple procedures
  288.                 { % multiple colors single proc. colors are interlaced.
  289.                   % have to grab individual colors from same string
  290.                     /proc0 edf    %this is the single proc
  291.                     ncolors 4 eq
  292.                     { %cmyk colors interlaced.
  293.                         { %begin new image procedure
  294.                             proc0 dup %first get string
  295.                             /st0 edf %and store it in st0
  296.                             0 exch %start
  297.                             4 exch %increment
  298.                             length %size of string
  299.                             dup 4 div cvi string /st1 edf %destination string is 1/4 the size
  300.                             4 sub
  301.                             {
  302.                                 % yank color for this plate
  303.                                 color 3 eq{dup st0 exch get}if            %cyan
  304.                                 color 2 eq{dup 1 add st0 exch get}if    %magenta
  305.                                 color 1 eq{dup 2 add st0 exch get}if    %yellow
  306.                                 color 0 eq{dup 3 add st0 exch get}if    %black
  307.                                 exch 4 div cvi exch    cvi % make sequential index
  308.                                 st1 3 1 roll put
  309.                             }for
  310.                             st1    %leave string on stack
  311.                         } %end of image proc definition
  312.                     } %end interlaced cmyk colors
  313.                     { %rgb colors interlaced. this has got to be the hardest
  314.                         {
  315.                             proc0 dup 
  316.                             /st0 edf %get the string and put it in st0
  317.                             0 exch %start
  318.                             3 exch %increment
  319.                             length %size of string
  320.                             dup 3 div cvi string /st1 edf %destination string is 1/3 the size
  321.                             3 sub
  322.                             {
  323.                                 dup st0 exch get 255.0 div            %get red
  324.                                 exch dup 1 add st0 exch get    255.0 div %get green
  325.                                 exch dup 2 add st0 exch get    255.0 div %get blue
  326.                                 exch %put index at top
  327.                                 %Stack == Red Green Blue Index
  328.                                 4 1 roll
  329.                                 %Stack == Index Red Green Blue
  330.                                 %now convert the RGB value to a good CMYK value to separate
  331.                                 do_ucrblack
  332.                                 /b edf
  333.                                 do_correct
  334.                                 /y edf
  335.                                 /m edf
  336.                                 /c edf
  337.                                 color 3 eq{c}if    %cyan
  338.                                 color 2 eq{m}if %magenta
  339.                                 color 1 eq{y}if    %yellow
  340.                                 color 0 eq{b}if %black
  341.                                 exch 3 div cvi exch    cvi %need sequential index
  342.                                 255.0 mul cvi
  343.                                 st1 3 1 roll put
  344.                             }for
  345.                             st1    %leave string on stack
  346.                         } % end of image proc definition
  347.                     } % end of rgb colors
  348.                     ifelse
  349.                     i
  350.                 } %end of multiple colors single proc
  351.                 ifelse
  352.             } %end of multiple colors
  353.             ifelse
  354.         } % end of if not composite plate
  355.         { %begin composite plate
  356.             %do composite stuff here
  357.             systemdict /colorimage known
  358.             { multiproc ncolors systemdict /colorimage get exec}
  359.             { multiproc not{ncolors icomp}if}ifelse
  360.         } %end of composite handling
  361.         ifelse
  362.     }bdf %define colorimage
  363. } def
  364.